import { AxiosResponse } from 'axios';
import { Post } from '../axios';


/* 添加域名 */
export const appdns = async (data: { dns: string }): Promise<AxiosResponse<any>> => {
    try {
        return await Post({ url: "/dns/appdns", data });
    } catch (error) {
        throw error
    }
}


/* 删除域名 */
export const deletedns = async (data: { id: string }): Promise<AxiosResponse<any>> => {
    try {
        return await Post({ url: "/dns/deletedns", data });
    } catch (error) {
        throw error
    }
}


/* 查询域名 */
interface GetcerInterface {
    (data: {
        pageNo: number,                    /* 当前页数 */
        pageSize: number,                  /* 页面总条数 */
        id?: string | null
    }): Promise<AxiosResponse<any>>
}
export const getdns: GetcerInterface = async (data) => {
    try {
        return await Post({ url: "/dns/getdns", data });
    } catch (error) {
        throw error
    }
}


/* 查询单条域名 */
interface GetdnsoneInterface {
    (data: {
        id: string
    }): Promise<AxiosResponse<any>>
}
export const getdnsone: GetdnsoneInterface = async (data) => {
    try {
        return await Post({ url: "/dns/getdnsone", data });
    } catch (error) {
        throw error
    }
}


